import { nodeResolve } from '@rollup/plugin-node-resolve'
import vue from 'rollup-plugin-vue'
import resolve from 'rollup-plugin-node-resolve'
import postcss from 'rollup-plugin-postcss'
import path from 'path'
// vue 和 vue-template-compiler 的版本保持一致,(目前都是2.6.14)
//vue2：rollup-plugin-vue^5.1.9 + vue-template-compiler
//vue3：rollup-plugin-vue^6.0.0 + @vue/compiler-sfc
//npm i --save-dev rollup-plugin-vue@5.1.9 rollup @rollup/plugin-node-resolve rollup-plugin-node-resolve postcss rollup-plugin-postcss
const file = type => `lib/${name}.js`;
const name = 'ygbh';

export { name, file }
export default {
    input: 'src/components/index.js',
    output: [
        {
            file: './lib/ygbh.js',
            format: 'umd',
            name: 'ygbh'
        },
        // {
        //     file: './lib/ygbh-es.js',
        //     format: 'es'
        // },
        // {
        //     file: './lib/ygbh-cjs.js',
        //     format: 'cjs'
        // },
    ],
    external: ['vue'],
    plugins: [
        nodeResolve(),
        vue({
            compileTemplate: true
        }),
        resolve(),
        postcss({
            extract:true,
            extract: path.resolve('./lib/ygbh.css')
        }),
    ]
}